<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">


<head>
    <title th:text="${pageTitle}"></title>
    <div data-th-replace="layout/head-top"></div>
    <link rel="stylesheet" type="text/css" th:href="@{{path}/common/v3/summernote/summernote-bs3.css?v={v}((path=${staticPath},v=${v})}">
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInLeft">
    <div>
        <div class="row">

            <div class="pt10">
                <div class="col-sm-9">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title"><h5>填写基本信息</h5></div>
                        <div class="ibox-content clearfix pt10">

                            <input hidden id="id" name="id" th:value="${topic['id']}" />
                            <input hidden id="crumbs" th:value="${crumbs}" />

                            <form class="form-horizontal m-t" id="classes-topic-form">
                                <div class="form-horizontal">
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label text-right"><i class="c-red">*</i> 话题标题</label>
                                        <div class="col-sm-8">
                                            <input th:value="${topic['title']}" placeholder="话题名称" class="validate-data form-control" name="title"/>
                                            <span class="help-block m-b-none c-999"> 话题标题</span>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>

                                    <div class="form-group">
                                        <label class="col-sm-2 control-label text-right"><i class="c-red">*</i> 话题内容</label>
                                        <div class="col-sm-10">
                                            <div id="content" th:utext="${topic['content']}"></div>
                                            <span class="help-block m-b-none c-999"> 话题内容</span>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>

                                    <div class="form-group">
                                        <label class="col-sm-2 control-label"> <i class="c-red">*</i> 选择话题类型</label>
                                        <div class="col-sm-8">
                                            <div class="clearfix">
                                                <div class="input-group">
                                                    <select th:disabled="${topic['status'] != 0}" id="topic-type-select" data-placeholder="选择话题类型" class="form-control mb10 chosen-select" style="width: 300px;">
                                                        <option value="">选择话题类型</option>
                                                        <option th:each="classify : ${classifies}"  th:value="${classify['value']}" th:text="${classify['name']}" th:selected="${topic['classify']} == ${classify['key']}"></option>
                                                    </select>
                                                </div>
                                            </div>
                                            <span class="help-block m-b-none c-999">选择话题类型</span>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>

                                    <div class="form-group">
                                        <label class="col-sm-2 control-label"> 浏览权限</label>
                                        <div class="col-sm-8">
                                            <div class="radio i-checks">
                                                <input type="radio" name="lookPermission" value="1" th:attr="checked=${topic['status']} == 0 or ${topic} !=null and ${topic['lookPermission']} == 1"/> <strong>自由浏览</strong>
                                                <input type="radio" name="lookPermission" value="2" th:attr="checked=${topic} !=null and ${topic['lookPermission']} == 2"/> <strong>登录后浏览</strong>
                                                <input type="radio" name="lookPermission" value="3" th:attr="checked=${topic} !=null and ${topic['lookPermission']} == 3"/> <strong>仅成员浏览</strong>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>

                                    <div class="form-group">
                                        <label class="col-sm-2 control-label"> 允许回复</label>
                                        <div class="col-sm-8">
                                            <div class="radio i-checks">
                                                <input type="radio" name="reply" value="1" th:attr="checked=${topic} !=null and ${topic['reply']} == 1"/><strong>是</strong>
                                                <input type="radio" name="reply" value="2" th:attr="checked=${topic['status']} == 0 or ${topic} != null and ${topic['reply']} == 2"/><strong>否</strong>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>

                                    <div class="form-group " th:classappend="${topic['reply']} == 2 or ${topic['status']} == 0 ? 'hide' : ''">
                                        <label class="col-sm-2 control-label"> 回复权限</label>
                                        <div class="col-sm-8">
                                            <div class="radio i-checks">
                                                <input type="radio" name="replyPermission" value="1" th:attr="checked=${topic['status']} == 0 or ${topic} !=null and ${topic['replyPermission']} == 1"/><strong>登录后回复</strong>
                                                <input type="radio" name="replyPermission" value="2" th:attr="checked=${topic} !=null and ${topic['replyPermission']} == 2"/><strong>仅成员回复</strong>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>

                                    <div class="form-group">
                                        <label class="col-sm-2 control-label"> 是否置顶</label>
                                        <div class="col-sm-8">
                                            <div class="radio i-checks">
                                                <input type="radio" name="top" value="1" th:attr="checked=${topic} !=null and ${topic['top']} == 1"/><strong>是</strong>
                                                <input type="radio" name="top" value="2" th:attr="checked=${topic['status']} == 0 or ${topic} !=null and ${topic['top']} == 2" /><strong>否</strong>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>

                                    <div class="form-group">
                                        <label class="col-sm-2 control-label text-right"><i class="c-red">*</i> 关联班级</label>
                                        <div class="col-sm-8">
                                            <p><button th:disabled="${topic['status'] != 0}" id="selectClasses" class="btn btn-primary" type="button"><i class="fa fa-plus"></i> 选择班级</button></p>
                                            <div class="well m-t mt10 no-padding">
                                                <table class="table table-bordered">
                                                    <thead>
                                                    <tr>
                                                        <th class="text-center" width="10%">ID</th>
                                                        <th class="text-center" width="20%">班级名称</th>
                                                        <th class="text-center" width="15%">操作</th>
                                                    </tr>
                                                    </thead>
                                                    <tbody id="classes-topic-classes">
                                                    <tr th:class="${topic['classes'] != null} ? 'hide'">
                                                        <td colspan="3" class="text-center">
                                                            <div class="noDataTipsBox">
                                                                <p><span class="c-4e fs16">还没有班级~~~</span></p>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                    <tr th:if="${topic['classes'] != null}" th:attr="data-classes=${topic['classes']['id']}">
                                                        <td class="text-center" th:text="${topic['classes']['id']}"></td>
                                                        <td class="text-center" th:text="${topic['classes']['name']}"></td>
                                                        <td class="text-center">
                                                            <a th:if="${topic['status'] == 0}" href="javascript:void(0)" data-original-title="删除" data-toggle="tooltip" class="c-master fs14">
                                                                <i class="fa fa-trash"></i>
                                                            </a>
                                                        </td>
                                                    </tr>
                                                    </tbody>
                                                </table>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>

                                    <div class="form-group">
                                        <div class="col-sm-8 col-sm-offset-2">
                                            <button id="savePublish" class="btn btn-danger" type="button">保存</button>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
                <div data-th-replace="common/importantNotes"></div>
            </div>
        </div>
    </div>
</div>
<div data-th-replace="layout/head-footer"></div>
<script type="text/javascript" th:src="@{{path}/common/summernote/summernote.min.js?v={v}(path=${staticPath},v=${v})}"></script>
<script type="text/javascript" th:src="@{{path}/common/summernote/summernote-zh-CN.js?v={v}(path=${staticPath},v=${v})}"></script>
<script type="text/javascript" th:src="@{{path}/admin/business/classes/topic/save-topic.js?v={v}(path=${staticPath},v=${v})}"></script>
</body>
</html>
